<template>
	<view class="content">
		<!-- <uni-collapse accordion="true"> -->
		    <!-- <uni-collapse-item title="删除项目（考试项目)" thumb="../../static/shanchu.png"> -->
				<!-- <view class="uni-title uni-common-pl">选择全国大赛获得comptionId</view> -->
				<view class="uni-list">
					<view class="uni-list-cell" style="display: inline-block;padding-left: 0;">
						<view class="uni-list-cell-left">
							选择比赛：
						</view>
						<view class="uni-list-cell-db">
							<picker @change="bindPickerChange" :value="index" :range="message" range-key="title">
								<view class="uni-input" style="color: red; width: 100%; line-height: 23px;border:1px solid #CCC ;margin: 0 auto;text-align: center;"> 
								{{message[index]=="" || message[index]==null?"请点击选择":message[index].title}}</view>
							</picker>
						</view>
					</view>
				</view>
				<!-- <view class="uni-list">
					<view class="uni-list-cell" style="display: inline-block;">
						<view class="uni-list-cell-left">
							选择需要删除的项目：
						</view>
						<view class="uni-list-cell-db">
							<picker @change="bindPickerChange" :value="index" :range="message" range-key="title">
								<view class="uni-input" style="width: 100%; line-height: 23px;border:1px solid #CCC ;">{{message[index].title}}</view>
							</picker>
						</view>
					</view>
				</view> -->
		    <!-- </uni-collapse-item><!-- 
		</uni-collapse> -->
	</view>
</template>

<script>
	import uniCollapse from '../../components/uni-collapse/uni-collapse.vue'
	import uniCollapseItem from '../../components/uni-collapse-item/uni-collapse-item.vue'
	import uniSection from '../../components/uni-section/uni-section.vue'
	
	export default{
		data(){
			return{
				delectList:{
					id:'',
					index:0
				},
				index: -1,
				swipeList: [
					{id: 1,
					options: [{
						text: '删除',
						style: {backgroundColor: 'rgb(255,58,49)'}
					}],
				}]
			}
		},
		methods:{
			bindPickerChange: function(e) {
				console.log('picker发送选择改变，携带值为：' +JSON.stringify(e))
				// console.log('picker发送选择改变，携带值id为：' + id)
				this.index = e.detail.value
				this.$emit('func',this.index)
			},
			swipeChange(e) {
				console.log('返回：', e);
			},
			swipeClick(id,index) {
				uni.showModal({
					title: '提示',
					content: '是否删除',
					success: (res) => {
						if (res.confirm) {
							this.delectList.id = id
							this.delectList.index = index
							this.$emit('func',JSON.stringify(this.delectList))
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},
		},
		 props: ["message"],
		components:{uniCollapse,uniCollapseItem,uniSection}
	}
</script>

<style lang="scss" scoped>
	view{
		width: 100%;
		font-size: 14px;
		text-align: left;
		background-color: #fff;
		// border-bottom: 2px solid #DDDDDD;
		line-height: 40px;
		button{
			width: 50%;
			font-size: 12px;
			background-color: #CCE6FF;
			margin: 10px auto;
		}
		input{
			width: 60%;
			border: 2px solid #CCE6FF;
			font-size: 12px;
			margin: 5px auto;
		}
	}
</style>
